<?php
$connection = \Yii::$app->db;
//var_dump($model);exit();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/site.css">
<!--    <link rel="stylesheet" type="text/css" href="css/use.css">-->
</head>
<body>

<div class="container">
    <div class="row">
        <div class="col-md-4 logol1">
            <a href="<?php echo \yii\helpers\Url::toRoute('index')?>">
                <h4 class="logol2">tower</h4>
            </a>
        </div>
        <div class="col-md-4 nav2">
            <ul class="nav nav-pills nav1">
                <li role="presentation"><a href="<?php echo \yii\helpers\Url::toRoute(['index'])?>">首页</a></li>
                <li role="presentation"><a href="#">价格</a></li>
                <li role="presentation"><a href="#">快速入门</a></li>
                <li role="presentation">
                    <div class="dropdown" id="resource">
                        <a data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            资源
                            <span class="caret"></span>
                            <ul class="nav nav-pills dropdown-menu nav1" aria-labelledby="dLabel">
                                <li><a data-target="#">帮助中心</a></li>
                                <li><a data-target="#">功能日志</a></li>
                                <li><a data-target="#">下载客户端</a></li>
                                <li><a data-target="#">企业微信</a></li>
                                <li><a data-target="#">企业服务精选</a></li>
                                <li><a data-target="#">@Towerim</a></li>
                                <li><a data-target="#">Tower公众号</a></li>
                            </ul>
                        </a>
                    </div>
                </li>
            </ul>
        </div>
        <div class="col-md-4 nav2">
            <button class="btn btn1 enter"><a href="#">进入 Tower</a></button>
        </div>
    </div>
</div>

<br><br><br><br>

<h2 style="text-align: center;">问题分类</h2>
<br><br>

<?php

$command = $connection->createCommand('SELECT * FROM question');
$question = $command->queryAll();
//foreach ($question as $item){
//
////    echo "<div>";
//    echo "<a  href= '".\yii\helpers\Url::toRoute(['use','id'=>$item['id']])."'class='thumbnail catalogue'>";
//    echo $item['id'];
//    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
//    echo $item['title'];
//    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
//    echo $item['description'];
//    echo "</a>";
//
////    print_r($item);
//
//
////    print_r($item['id']);
////    exit();
////    echo "</div>";
//}
////exit;
//
//
////                        foreach ($question as $value)
////                        {
////                            echo $value;
////                        }
////                        print_r($question);exit(0);
////                        echo $question['title'];
//?>

<div class="container">

    <?php
        foreach ($question as $item){
    ?>
    <div class="row">
        <div class="col-sm-6 col-md-4">

            <a href="<?= \yii\helpers\Url::toRoute(['use', 'id' => $item['id']]) ?>" class="thumbnail catalogue">
                <!-- $model2是变量名，从QuestionController传过来 -->
                <img src="image/question.png" alt="..." class="icon1">
                <h4 class="catalogue-title">
                    <?php
                    echo $item['title'];
                    ?>
                </h4>
                <h5 class="desc">
                    <?php
                    echo $item['description'];
                    //
                    ?>
                </h5>
            </a>
        </div>
        <?php
        }
        ?>


</div>
<br><br><br><br>
<footer class="footer2">
    <div class="container">
			<span class="p2">
					<a href="#">服务条款</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="#">付费方案</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="#">帮助中心</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="#">功能日志</a>
			</span>
        <br><br>
        <!-- <ul>
            <li><a href="#">服务条款</a></li>
            <li><a href="#">付费方案</a></li>
            <li><a href="#">帮助中心</a></li>
            <li><a href="#">功能日志</a></li>
        </ul> -->
        <p class="p1">
            川B2-20130052 &nbsp; 蜀ICP备12019256号-5 &nbsp; © Mycolorway Design.
        </p>
    </div>
</footer>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>